#include<iostream>
using namespace std;
typedef struct BinSortTree
{
	int data;
	struct BinSortTree* lchild;
	struct BinSortTree* rchild;
}BST;
bool Is_Sort_Tree(BST* b, int arr[],int n)
{
	if (b == NULL || arr == NULL|| n<=0) {
		return false;
	}
	int index = arr[n - 1];
	int i = 0, j = 0;
	for (i = 0; i < n - 1; i++) {
		if (arr[i] > index) {
			break;
		}
	}
	j = i + 1;
	for (; j < n - 1; j++) {
		if (arr[j] < index) {
			return false;
		}
	}
	bool left = true;
	if (i > 0) {
		left = Is_Sort_Tree(b->lchild, arr, i);
	}
	bool right = true;
	if (j < n - 1) {
		right = Is_Sort_Tree(b->rchild, arr, n - j);
	}
	return (left && right);
}
